/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package merlion.mrp.ppm.session;

import java.sql.Timestamp;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.Collection;
import javax.ejb.Local;
import merlion.mrp.ppm.entity.DailyMPS;
import merlion.mrp.ppm.entity.Product;
import merlion.mrp.ppm.entity.SOP;
import merlion.mrp.ppm.entity.WeeklyMPS;
import merlion.mrp.ppm.pojo.ScheduleResultTemp;
import merlion.scm.lcm.entity.DeliveryOrder;

/**
 *
 * @author Zhang Ying, Zhu Xin
 */
@Local
public interface MPSPlanningSessionLocal {

    public boolean checkWeeklyMPSAvailable(int selectedMonth, Integer selectedYear);

    public int getTotalWorkingDaysForMonth(int month, Integer selectedYear);

    public ArrayList<ArrayList<Long>> getWeeklyDemandForOneMonth(int month, Integer selectedYear);

    public ArrayList<Long> getMonthlyDemand(int month, Integer selectedYear);


    public ArrayList<ArrayList<Timestamp>> getStartEndDaysList(int month, Integer selectedYear);
    
    public SOP getSOPForMPS (int selectedMonth, Integer selectedYear);
    
    public ArrayList<Integer> getWorkingDaysList(int selectedMonth, Integer selectedYear);
    
    public ArrayList<ArrayList<Long>> getEachDayDemandForOneWeek(int selectedYear, Integer selectedMonth, Integer selectedWeek);
    
    public ArrayList<Timestamp> getDatesforWeek(int selectedYear, Integer selectedMonth, Integer selectedWeek);
    
    public boolean checkAbleToCreateDailyMPS (int selectedYear, int selectedMonth, int selectedWeek);

    public Product getProduct(int i);

    //public boolean persistDailyMPS(DailyMPS newDMPS, Long id);
    
    public boolean updateDailyMPS2(DailyMPS updatedDMPS, ArrayList<ArrayList<Long>> prevDailyDemandList, ArrayList<ArrayList<Long>> prevDailyOTDemandList);


    public ScheduleResultTemp getScheduleResult(DailyMPS dailyDMPS);

    public Collection<DailyMPS> getAllDailyMPS();

    public boolean checkRawMaterial(DailyMPS dailyMPS);
    
    public WeeklyMPS createWeeklyMPS(int selectedMonth, Integer selectedYear);
    
    public WeeklyMPS updateWeeklyMPS(int selectedYear, Integer selectedMonth);
    
    public ArrayList<ArrayList<Long>> getEachWeekDemandForOneMonth(int selectedMonth,int selectedYear);
    
    public DailyMPS createDailyMPS(int selectedYear, Integer selectedMonth, Integer weekNo);
    
    public Integer getNumberOfWeeks(int year, int month);
    
    public DailyMPS updateDailyMPS(int selectedYear, Integer selectedMonth, Integer weekNo);
    
    public WeeklyMPS getWeeklyMPS(int startYear, int startMonth);

    public Double returnUtilization(boolean normal, ArrayList<Double> line);

    public Double returnCapacity(boolean normal, ArrayList<Double> line);

    public java.util.Calendar getFirstMondayOfMonth(int selectedYear, int selectedMonth);
    
    public boolean unreservePlannedProduction(DeliveryOrder order);
    
    public DailyMPS getDailyMPS(Integer selectedYear, Integer selectedMonth, Integer selectedWeek);
    
    public Calendar getFirstDayOfMonth(int year, int month);
    
    public WeeklyMPS updateWMPSTriggerByDMPS(DailyMPS newDMPS);
}